else
button.set_position(Math.floor(buttonX), Math.floor(buttonY));
+ // Clutter.Actor.get_preferred_width() will return the fixed width if one
+ // is set, so we need to reset the width by calling set_width(-1), to forward
+ // the call down to StLabel.
+ // We also need to save and restore the current width, otherwise the animation
+ // starts from the wrong point.
+ let prevTitleWidth = title.width;
+ title.set_width(-1);
let [titleMinWidth, titleNatWidth] = title.get_preferred_width(-1);
let titleWidth = Math.max(titleMinWidth, Math.min(titleNatWidth, cloneWidth));
+ title.width = prevTitleWidth;
let titleX = cloneX + (cloneWidth - titleWidth) / 2;
let titleY = cloneY + cloneHeight + title._spacing;